﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using DataAccess.ArchivesTableAdapters;
using DataAccess;

namespace BusinessLogic
{
    [DataObject]
    public class RecipientBO
    {
        private tblRecipientsTableAdapter RecipientAdapter = null;
        protected tblRecipientsTableAdapter Adapter
        {
            get
            {
                if (RecipientAdapter == null)
                    RecipientAdapter = new tblRecipientsTableAdapter();
                return RecipientAdapter;
            }
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
        public Archives.tblRecipientsDataTable GetAllRecipients()
        {
            return Adapter.GetAllRecipients();
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public Archives.tblRecipientsDataTable GetAllRecipients(string docID)
        {
            return Adapter.GetByDocID(Int32.Parse(docID));
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Insert, true)]
        public int AddNewRecipient(int docID, int depID)
        {
            return Adapter.AddNewRecipient(docID, depID);
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Update, true)]
        public int UpdateRecipients(int depID, int docID, int original_depID)
        {
            return Adapter.UpdateRecipient(depID, docID, original_depID);
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Delete, true)]
        public int DeleteRecipient(int docID, int depID)
        {
            return Adapter.DeleteRecipient(docID, depID);
        }
    }
}
